<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%@ include file="/common/taglibs.jsp" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>系统管理</title>
    <link href="${cdnctx}/dep/jquery/jquery-ui-1.10.2.custom.css" rel="stylesheet" type="text/css"/>
    <%@ include file="/common/util.jsp" %>
    <script type="text/javascript">
        var traLightCodes = [];
        var ledLightCodes = [];
        //灯具的自动填充
        var traLightCodes = eval('${traLightCodeInfo }');
        var ledLightCodes = eval('${ledLightCodeInfo }');

        function lightAutoComplete() {
            $("input[name='tralightcode']").autocomplete({
                source: traLightCodes,
                minLength: 0
            });
            $("input[name='ledlightcode']").autocomplete({
                source: ledLightCodes,
                minLength: 0
            });
            //点击灯具输入框则自动弹出列表
            $("input[name='tralightcode']").focus(function () {
                $(this).autocomplete('search');
            });
            $("input[name='ledlightcode']").focus(function () {
                $(this).autocomplete('search');
            });
        }
        $(document).ready(function () {
//灯具自动完成
            lightAutoComplete();
            $("#PointLightEditForm").validate({
                rules: {
                    'ledlightcode': {
                        required: true
                    },
                    'tranum': {
                        required: true,
                        digits: true
                    },
                    'tralightcode': {
                        required: true
                    },
                    'lednum': {
                        required: true,
                        digits: true
                    }
                },
                messages: {
                    'ledlightcode': {
                        required: "led灯具番号"
                    },
                    'tranum': {
                        required: "led灯具数量",
                        digits: "请输入合法的数量格式"
                    },
                    'lednum': {
                        required: "传统灯具数量",
                        digits: "请输入合法的数量格式"
                    },
                    'tralightcode': {
                        required: "传统灯具番号"
                    }
                },
                submitHandler: function (form) {   //提交前的处理
                    var trcode = $("input[name='tralightcode']").val();
                    var lecode = $("input[name='ledlightcode']").val();
                    if (traLightCodes.indexOf(trcode) >= 0 && ledLightCodes.indexOf(lecode) >= 0) {
                        form.submit();
                    } else {
                        $("#error").text('请输入正确的灯具番号');
                    }
                }
            });

        });


    </script>
</head>
<body class="main">
<div class="-frame -style -luster" id="css_container">
    <!--首页框架页眉部分↓-->
    <%@ include file="/WEB-INF/pages/inc/header.jsp" %>
    <!--首页框架页眉部分↑-->

    <div class="content">

        <!-- Left导航菜单◎开始 -->
        <%@ include file="/WEB-INF/pages/inc/leftmenu.jsp" %>
        <!-- Left导航菜单◎结束 -->

        <div class="main-mid">
            <div class="pos"><img src="${cdnctx}/src/index/img/index.png">
                <a href="<%--${cdnctx}/system/systemMenu.shtml--%>">系统管理 </a>
                ><a href="${cdnctx}/system/customerinfo/customerMain.shtml">公司信息管理</a>
                ><a href="${cdnctx}/systemCustomerArea/customerAreaList.shtml?customerinfoid=${customerArea.customerinfoid }">${customerArea.companyname }</a>
                ><a href="${cdnctx}/systemAreaPoint/areaPointList.shtml?areaid=${customerArea.id }&customerinfoid=${customerArea.customerinfoid }">${customerArea.areaname }</a>
                ><a href="${cdnctx }/systemPointLight/PointLightList.shtml?pointid=${areaPoint.id}">${areaPoint.pointname }</a>
                ><a><c:if test="${empty pointLight.id }">添加</c:if><c:if
                        test="${not empty pointLight.id }">编辑</c:if>灯具设备</a>
            </div>
            <div class="css_contentDiv">
                <div class="searchDetailed">
                    <form id="PointLightEditForm" method="post"
                          action="${cdnctx}/systemPointLight/savePointLight.shtml">
                        <input type="hidden" name="id" id="id" value="${pointLight.id }"/>
                        <input type="hidden" name="pointid" id="pointid" value="${areaPoint.id }"></input>
                        <input type="hidden" name="areaid" id="areaid" value="${customerArea.id }"/>
                        <input type="hidden" name="customerinfoid" id="customerinfoid"
                               value="${customerArea.customerinfoid }"/>
                        <table align="center" id="table" width="800" border="0" cellspacing="0" cellpadding="0">
                            <tbody class="ligthTr">
                            <tr>
                                <td class="mainText"><label class="formlabel"><font color="red">*</font>传统灯具：</label>
                                </td>
                                <td>
                                    <input type="hidden" name="tralightid" id="tralightid"
                                           value="${pointLight.tralightid }"/>
                                    <input type="text" name="tralightcode" id="tralightcode"
                                           value="${pointLight.tralightcode }" class="form_input large">
                                    <font color="red">*</font>数量：<input class="form_input" name="tranum" id="tranum"
                                                                        value="${pointLight.tranum }" type="text"
                                                                        style="width:50px"/>&nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td class="mainText">
                                    <label class="formlabel"><font color="red">*</font>LED灯具：</label>
                                </td>
                                <td>
                                    <input type="hidden" name="ledlightid" id="ledlightid"
                                           value="${pointLight.ledlightid }"/>
                                    <input type="text" name="ledlightcode" id="ledlightcode"
                                           value="${pointLight.ledlightcode }" class="form_input large">
                                    <font color="red">*</font>数量：<input class="form_input" name="lednum" id="lednum"
                                                                        value="${pointLight.lednum }" type="text"
                                                                        style="width:50px"/>&nbsp;
                                    <font id="error" color="red"></font>
                                </td>
                            </tr>
                            </tbody>
                            <tr>
                                <td><label class="formlabel">使用灯具类型:</label></td>
                                <td>
                                    传统灯具：<input type="radio" name="reallighttype" value="${tralight}"
                                                <c:if test="${pointLight.reallighttype==tralight}">checked</c:if>/>
                                    LED灯具：<input type="radio" name="reallighttype" value="${ledlight}"
                                                 <c:if test="${pointLight.reallighttype==ledlight||empty(pointLight.reallighttype)}">checked</c:if>/>
                                </td>
                            </tr>
                            <tr >
                                <td></td>
                                <td>
                                    <input type="submit" class="form_save" style="margin-top: 10px" value="保&nbsp;存"/>
                                    <input type="reset" class="form_cancle" value="取&nbsp;消"/>
                                </td>
                            </tr>
                        </table>
                    </form>
                </div>
            </div>
        </div>

    </div>

    <!--首页框架页尾部分↓-->
    <%@ include file="/WEB-INF/pages/inc/footer.jsp" %>
    <!--首页框架页尾部分↑-->
</div>
</body>
</html>